const express = require('express');
const router = express.Router();
// 引进mockjs
const Mock = require('mockjs');

// 监听路由
router.get('/list', (req, res) => {
    // 准备随机数据
    var data = {
        code: 0,
        success: true,
        data: Mock.mock({
            'list|1-20': [
                {
                    'name|3-5': /[a-z][A-Z]/,
                    'age|10-15': 15,
                    'gender|1': true,
                },
            ],
        }),
    };
    res.end(JSON.stringify(data));
});

module.exports = router;
